
# why use naked resources here: these are records that points to
# different ip addresses between aliyun private zones and our internal
# dns server.
#
# the records on aliyun could point to an internal address, while on our
# own internal dns server, it points to an external ip! orz

locals {
  dr_cn_alicloud_zone_id = "ed5ac8ffd35b17c4f0e60c587d647963"
  dr_cn_zone_name        = "deeproute.cn"

  dr_ai_alicloud_zone_id = "67ff7316bb7bab072a3cda2ba8822160"
  dr_ai_zone_name        = "deeproute.ai"
}

# -----------------

resource "alicloud_pvtz_zone_record" "apk-download" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr      = "apk-download"
  type    = "A"
  value   = "10.8.1.25"
  remark  = "Visualizer的包下载"
}

resource "deeproute_dns_record" "apk-download" {
  zone = local.dr_cn_zone_name

  rr    = "apk-download"
  type  = "A"
  ttl   = 60
  value = "183.61.62.44"
}

# -----------------

resource "alicloud_pvtz_zone_record" "rc" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr      = "rc"
  type    = "A"
  ttl     = 60
  value   = "10.250.73.5"
  remark  = "远程控制服务"
}

resource "deeproute_dns_record" "rc" {
  zone  = local.dr_cn_zone_name
  rr    = "rc"
  type  = "A"
  ttl   = 3600
  value = "120.25.175.30"
}

# -----------------

resource "alicloud_pvtz_zone_record" "rtkcn" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "rtkcn"
  type  = "A"
  value = "10.250.73.9"
  remark = "RTK基础服务"
}

resource "deeproute_dns_record" "rtkcn" {
  zone  = local.dr_cn_zone_name

  rr    = "rtkcn"
  type  = "A"
  ttl   = 3600
  value = "120.79.54.163"
}

# -----------------

resource "alicloud_pvtz_zone_record" "drrun-debug" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "drrun-debug"
  type  = "A"
  value = "120.78.210.239"
  remark = "运营系统"
}

resource "deeproute_dns_record" "drrun-debug" {
  zone  = local.dr_cn_zone_name

  rr    = "drrun-debug"
  type  = "A"
  ttl   = 3600
  value = "183.61.62.44"
}

# -----------------

resource "alicloud_pvtz_zone_record" "drrun-backup" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "drrun-backup"
  type  = "A"
  value = "120.78.210.239"
  remark = "运营系统"
}

resource "deeproute_dns_record" "drrun-backup" {
  zone  = local.dr_cn_zone_name
  rr    = "drrun-backup"
  type  = "A"
  ttl   = 3600
  value = "183.61.62.44"
}

# -----------------

resource "alicloud_pvtz_zone_record" "drrun" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "drrun"
  type  = "A"
  ttl   = 30
  value = "192.168.1.44"
  remark = "车辆运营系统"
}

resource "deeproute_dns_record" "drrun" {
  zone  = local.dr_cn_zone_name
  rr    = "drrun"
  type  = "A"
  ttl   = 3600
  value = "119.23.61.102"
}

# -----------------

resource "alicloud_pvtz_zone_record" "hw" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "hw"
  type  = "A"
  ttl   = 30
  value = "10.8.1.16"
  remark = "日志服务系统"
}

resource "deeproute_dns_record" "hw" {
  zone  = local.dr_cn_zone_name
  rr    = "hw"
  type  = "A"
  ttl   = 3600
  value = "183.61.62.44"
}

# -----------------

resource "alicloud_pvtz_zone_record" "prod-v1-mesh" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "prod-v1.mesh"
  type  = "A"
  value = "10.8.1.19"
  remark = "mesh-sender-2.x"
}

resource "deeproute_dns_record" "prod-v1-mesh" {
  zone  = local.dr_cn_zone_name
  rr    = "prod-v1.mesh"
  type  = "A"
  ttl   = 3600
  value = "183.61.62.44"
}

# -----------------

resource "alicloud_pvtz_zone_record" "qa-v1-mesh" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "qa-v1.mesh"
  type  = "A"
  value = "10.3.2.95"
  remark = "mesh-sender-2.x"
}

resource "deeproute_dns_record" "qa-v1-mesh" {
  zone  = local.dr_cn_zone_name
  rr    = "qa-v1.mesh"
  type  = "A"
  ttl   = 3600
  value = "183.61.62.45"
}

# -----------------

resource "alicloud_pvtz_zone_record" "dev-v1-mesh" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "dev-v1.mesh"
  type  = "A"
  value = "10.3.2.94"
  remark = "mesh-sender-2.x"
}

resource "deeproute_dns_record" "dev-v1-mesh" {
  zone  = local.dr_cn_zone_name
  rr    = "dev-v1.mesh"
  type  = "A"
  ttl   = 3600
  value = "183.61.62.44"
}

# -----------------

resource "alicloud_pvtz_zone_record" "nexus" {
  zone_id = local.dr_ai_alicloud_zone_id
  rr    = "nexus"
  type  = "A"
  ttl   = 60
  value = "10.10.12.43"
}

resource "deeproute_dns_record" "nexus" {
  zone  = local.dr_ai_zone_name
  rr    = "nexus"
  type  = "A"
  ttl   = 3600
  value = "10.10.12.43"
}

# -----------------

resource "alicloud_pvtz_zone_record" "apt" {
  zone_id = local.dr_cn_alicloud_zone_id
  rr    = "apt"
  type  = "A"
  ttl   = 60
  value = "10.10.12.43"
  remark = "生产营运环境，拉取deb包"
}

resource "deeproute_dns_record" "apt" {
  zone  = local.dr_cn_zone_name
  rr    = "apt"
  type  = "A"
  ttl   = 60
  value = "10.10.12.43"
}

# -----------------
